let app = getApp()
Component({
    properties: {
      item: {
        type: Object,
        observer: function(newVal, oldVal) {
          this.updateitem()
        }
      },
      list:{
        type:Array
      },
      styleType:{
        type:Number
      },
      type: {
        type: String
      }
      },
      data: {
        styleType:'style1',
        styleMap: {
          1: "style3",
          2: "style9",
          3: "style10"
        },
        activityMap: { 
            diy_bargain: {
                title: "砍价活动",
                buttonText: "去砍价",
                type: "bargain",
                moreLink: {
                    type: "bargain_list",
                    title: "砍价"
                }
            },
            diy_seckill: {
                title: "秒杀活动",
                buttonText: "去秒杀",
                type: "seckill",
                moreLink: {
                    type: "seckill_list",
                    title: "秒杀"
                }
            },
            diy_group: {
                title: "拼团活动",
                buttonText: "去拼团",
                type: "group",
                moreLink: {
                    type: "group_list",
                    title: "拼团"
                }
            },
            diy_integral: {
                title: "积分换购",
                type: "integral",
                buttonText: "",
                buttonHidden: !0,
                moreLink: {
                    type: "page_integral_mall",
                    title: "积分商城"
                }
            }
        }
    },
    lifetimes: {
        attached: function () {
          var that=this
          var len=that.data.list.length-1
          this.setData({
            globalColor:app.globalData.globalColor,
            type:that.data.type,
            allEndTime:that.data.list[len].end_time
          })
       }
      },
       methods: {
        updateitem:function(){
          var style_type=this.data.item.type_index
          this.setData({
            styleType:style_type
          })
        },
        callback:function(e){
          console.log('已结束')
        },
        lookmore:function(){
          if(this.data.type=='diy_seckill'){
            wx.navigateTo({
              url: '/yb_shopv2/native/all/index?type=seckill_list',
            })
           }
          if(this.data.type=='diy_integral'){
            wx.navigateTo({
              url: '/yb_shopv2/native/all/index?type=page_integral_mall',
            })
           }
           if(this.data.type=='diy_group'){
            wx.navigateTo({
              url: '/yb_shopv2/native/all/index?type=group_list',
            })
           }
           if(this.data.type=='diy_bargain'){
            wx.navigateTo({
              url: '/yb_shopv2/native/all/index?type=bargain_list',
            })
           }
        }
    }
});
